package com.gdcnano.nanoamp.media.sound
{
	import flash.media.Sound;
	import flash.media.SoundChannel;
	
	public class PauseState implements ISoundState
	{
		private var _soundManager:SoundManager;
		
		public function PauseState(soundManager:SoundManager)
		{
			_soundManager = soundManager;
		}
		
		public function startPlay(sound:Sound, soundChannel:SoundChannel, startPosition:Number):SoundChannel
		{
			soundChannel = sound.play(startPosition);
			_soundManager.setState(_soundManager.playState);
			return soundChannel;
		}
		
		public function stopPlay(soundChannel:SoundChannel):void
		{
			soundChannel.stop();
			_soundManager.setState(_soundManager.stopState);
		}
		
		public function pause(soundChannel:SoundChannel):Number
		{
			// already in pause state
			return soundChannel.position;
		}
	}
}